

function factory (UserModel) {
  return function (req, res) {
    //  验证密码
    //  body: {userId: userId, password: password}
    //  密码错误返回 0
    var body = req.body
    UserModel.findOne({_id: body.userId}, function (err, user) {
      if (user.password === body.password) {
        res.send('1')
      }else {
        res.send('0')
      }
    })
  }
}

module.exports = factory